#ifndef __BSP_EPD_SSD1677_H__
#define __BSP_EPD_SSD1677_H__

#include <stdint.h>

#define EPD_WIDTH 480
#define EPD_HEIGHT 800
#define EPD_SCREEN_SIZE (EPD_WIDTH * EPD_HEIGHT / 8) // 屏幕大小

#ifndef WHITE
#define WHITE          0xFF
#define BLACK          0x00
#endif

#define EPD_REF_MODE_GC 0 // 450ms
#define EPD_REF_MODE_DU 1 // 260ms
#define EPD_REF_MODE_A2 2 // 120ms

void bsp_epd_init(void);
void epd_hw_reset(void);
void epd_sw_reset(void);
void epd_1gray_init(void);
void epd_1gray_refresh(uint8_t mode);
void epd_1gray_clear_norefresh(void);
void epd_auto_refresh(uint8_t mode);
void epd_1gray_clear(uint8_t mode);
void epd_1gray_clear_color(uint8_t mode, uint8_t color);
void epd_1gray_display_all(const uint8_t *image,uint8_t mode);

void epd_1gray_display_part(const uint8_t *image, uint16_t Xstart,uint16_t Ystart,uint16_t Xend,uint16_t Yend);
void epd_1gray_display_part_icon(const uint8_t *image, uint16_t x_start,uint16_t y_start,uint16_t iwidth,uint16_t iheight);
void epd_1gray_display_part_icon_edge(const uint8_t *image, uint16_t x_start,uint16_t y_start,uint16_t iwidth,uint16_t iheight);

void epd_delay(uint32_t ms);
// Function prototypes for epd functions
void epd_write_cmd(uint8_t cmd);
void epd_write_data(uint8_t data);
void epd_write_multidata(uint8_t *pdata, uint16_t len);

void epd_clear_black(void);
void epd_clear_white(void);

void epd_deep_sleep(void);

void epd_update(void);
void epd_part_update(void);
void epd_fast_update(void);

void epd_write_image(uint8_t *image);
void epd_write_image_fast(uint8_t *image);
void epd_write_image_part(uint32_t x_start,uint32_t y_start,const uint8_t * datas,uint32_t PART_COLUMN,uint32_t PART_LINE);
void epd_write_image_part_all(uint8_t *image);
void epd_clear_part(uint32_t x_start,uint32_t y_start, uint8_t color, uint32_t PART_COLUMN,uint32_t PART_LINE);
void epd_write_image_edge_part(uint32_t x_start,uint32_t y_start,const uint8_t * datas,uint32_t PART_COLUMN,uint32_t PART_LINE);

// GD驱动 gooddisplay
void epd_gd_hw_init(void);
void epd_gd_hw_init_fast(void);
void epd_gd_update(void);
void epd_gd_update_fast(void);
void epd_gd_part_update(void);
void epd_gd_writescreen_all(const unsigned char * datas);
void epd_gd_writescreen_all_fast(const unsigned char * datas);
void epd_gd_writescreen_white(void);
void epd_gd_writescreen_black(void);
void epd_gd_setramvalue_basemap(const unsigned char * datas);
void epd_gd_dis_part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE);
void epd_gd_dis_partall(const unsigned char * datas);
void epd_gd_deepsleep(void);
void epd_gd_dis_part_ram(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE);
void epd_gd_hw_init_180(void);
void epd_gd_hw_init_gui(void);




#endif 



